package com.yunhe.ssm.mybatis.service.impl;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yunhe.ssm.mybatis.dao.TeacherDao;
import com.yunhe.ssm.mybatis.model.Page;
import com.yunhe.ssm.mybatis.model.Teacher;
import com.yunhe.ssm.mybatis.service.ITeacherService;
@Service
public class TeacherServiceImpl implements ITeacherService {
	@Autowired
	private TeacherDao teacherdao;
	@Override
	public Teacher teacherLogin(Teacher teacher) {
		
		return teacherdao.teacherLogin(teacher);
	}
	@Override
	public Teacher getTeacherById(Teacher teacher) {
		
		return teacherdao.getTeacherById(teacher);
	}
	@Override
	public Page getTeacherPage(Map<String, Object> cond) {
		Page page=new Page();
		page.setTotalnum(teacherdao.getTeacherTotal());
		int pageSize = Integer.parseInt(String.valueOf(cond.get("pageSize")));
		int curPageNum = Integer.parseInt(String.valueOf(cond.get("pageNum")));
		page.setCurpage(curPageNum);
		page.setPagesize(pageSize);
		page.setResult(teacherdao.getTeacherPage(page));
		return page;
	}

}
